<template>
  <j-modal :title="title" :width="width" :visible="visible" switchFullscreen @ok="handleOk"
    :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <j-form-container :disabled="disableSubmit">
        <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
          <a-row>
            <a-col :span="24">
              <a-form-model-item label="所属公司" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="code">
                <j-search-select-tag
                  v-model="model.code"
                  placeholder="请选择所属公司"
                  dict="lg_sys_third_org,name,code,status = 'Y'"
                />
              </a-form-model-item>
            </a-col>
            
          </a-row>
         <!-- <a-row type="flex" justify="center">
            <a-col class="classTip" :span="24">
              <div>确定要开始同步全部数据吗？可能花费较长时间！ </div>
              <div style="color: red;">新员工填写个人档案，需先同步钉钉到本地</div>
            </a-col>
          </a-row> -->
        </a-form-model>
      </j-form-container>
      </a-spin>
  </j-modal>
</template>

<script>
  export default {
    name: 'SysThirdOrgModal',
    components: { },
    data() {
      return {
        title: '',
        width: 600,
        visible: false,
        disableSubmit: false,
        confirmLoading:false,
        model:{},
        validatorRules: {
          code:[{ required: true, message: '请选择所属公司' }]
        }, 
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
      }
    },
    methods: {
      add() {
        this.visible = true
      },
      edit(record) {
        this.visible = true
      },
      close() {
        this.$emit('close');
        this.visible = false;
      },
      handleOk() {
        // this.$refs.realForm.submitForm();
        // this.$emit('ok',this.model.code);
        // this.visible = false;
        const that = this;
        // 触发表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            this.$emit('ok',this.model.code);
            this.visible = false;       
          }        
        })
      },
      submitCallback() {
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel() {
        this.close()
      }
    }
  }
</script>
<style scoped>
  .classTip{
      text-align: center;
      line-height: 33px;
  }
  </style>